#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;

struct node
{
    int number;
    node* nextnode;
};

int main()
{
    node* temp; // temp has a value which points us to a memory declared now containing a value of 0;
    temp = new node; // Temp now points to a valid memory allocation;
    temp->number = 50;
    node* secondnode;
    secondnode= new node;
    temp->nextnode = secondnode; // passing the "address" to the next node reference
    secondnode->number = 20;
    node* lastnode;
    lastnode = new node;
    secondnode->nextnode = lastnode;
    lastnode->number = 30;
    lastnode->nextnode = NULL;
    int x =1;
    while (x!=0)
    {
        cout << temp->number << endl;
        cout << temp->nextnode << endl;
        cout << secondnode->number << endl;
        cout << secondnode->nextnode << endl;
        cout << lastnode->number << endl;
        cout << lastnode->nextnode << endl;
        cin >> x;
    }
}
